import api from '../http'
import { CommunityModel } from './model'

export const getCity = (params: any) => {
  return api({
    url: '/City/selectCity',
    method: 'POST',
    params,
  })
}

//搜索社区名
export const queryKey = (params: any) => {
  return api({
    url: '/community/keywords',
    method: 'GET',
    params,
  })
}

//获取社区列表
export const apiList = (params: any) => {
  return api({
    url: '/community/list',
    method: 'GET',
    params,
  })
}

//新增
export const apiAdd = (data: CommunityModel) => {
  return api({
    url: '/community/add',
    method: 'POST',
    data,
  })
}

//修改
export const apiUpdate = (data: CommunityModel) => {
  return api({
    url: '/community/update',
    method: 'PUT',
    data,
  })
}

//查询
export const apiGetDetails = (communityId) => {
  return api({
    url: `/community/query/${communityId}`,
    method: 'GET',
  })
}

//删除
export const apiDelete = (communityId) => {
  return api({
    url: `/community/${communityId}`,
    method: 'DELETE',
  })
}

//获取所有
export const apiAllList = () => {
  return api({
    url: `/community/getAll`,
    method: 'GET',
  })
}
